_base_ = "base_nwpuv2.py"

model = dict(
    backbone=dict(
        norm_cfg=dict(requires_grad=True),
        norm_eval=True,
        style="caffe",
        init_cfg=dict(
            type="Pretrained", checkpoint="open-mmlab://detectron2/resnet50_caffe"
        ),

    ),
    roi_head=dict(bbox_head=dict(num_classes=10)),
)

data = dict(
    samples_per_gpu=2,
    workers_per_gpu=0,
    train=dict(
        sup=dict(
            type="NWPUv2Dataset",
            ann_file="data/coco/annotations/semi_supervised/instances_train2017.${fold}@${percent}.json",
            img_prefix="data/coco/train2017/",
        ),
        unsup=dict(
            type="NWPUv2Dataset",
            ann_file="data/coco/annotations/semi_supervised/instances_train2017.${fold}@${percent}-unlabeled.json",
            img_prefix="data/coco/train2017/",
        ),
    ),
    sampler=dict(
        train=dict(
            sample_ratio=[1, 4],
        )
    ),
)

fold = 1
percent = 10

work_dir = "work_dirs/${cfg_name}/${percent}/${fold}"
log_config = dict(
    interval=50,
    hooks=[
        dict(type="TextLoggerHook"),
#         dict(
#             type="WandbLoggerHook",
#             init_kwargs=dict(
#                 project="pre_release",
#                 name="${cfg_name}",
#                 config=dict(
#                     fold="${fold}",
#                     percent="${percent}",
#                     work_dirs="${work_dir}",
#                     total_step="${runner.max_iters}",
#                 ),
#             ),
#             by_epoch=False,
#         ),
    ],
)
evaluation = dict(type="SubModulesDistEvalHook", interval=2000)
optimizer = dict(type="SGD", lr=0.01, momentum=0.9, weight_decay=0.0001)
lr_config = dict(step=[12000, 16000])
runner = dict(_delete_=True, type="IterBasedRunner", max_iters=18000)
checkpoint_config = dict(by_epoch=False, interval=4000, max_keep_ckpts=20)
